<?php
/** @noinspection PhpMissingReturnTypeInspection */

/** @noinspection PhpMissingDocCommentInspection */

/** @noinspection PhpDocSignatureIsNotCompleteInspection */

declare(strict_types=1);

namespace DreamCat\ControllerParamGen\HelperClass\Controller;

use DreamCat\ControllerParamGen\Annotation\CtlParamType;
use DreamCat\ControllerParamGen\HelperClass\Vo\ComplexVO;
use DreamCat\ControllerParamGen\HelperClass\Vo\DemoVo;
use DreamCat\ControllerParamGen\HelperClass\Vo\OutputVo;
use JetBrains\PhpStorm\Pure;
use stdClass;

/**
 * 示例控制器
 * @author vijay
 */
class DemoController
{
    /**
     * @param string $label
     * @param int $page
     * @param array $body
     * @param array $path
     * @param int $pageSize
     * @return void
     */
    public function demo(
        #[CtlParamType(CtlParamType::TYPE_PATH_VARIABLE, "label")] string $label,
        int $page,
        #[CtlParamType] array $body,
        #[CtlParamType(CtlParamType::TYPE_PATH_VARIABLE)] array $path,
        int $pageSize = 10,
        #[CtlParamType(CtlParamType::TYPE_HEADER)]
        string $headerV = "hh",
        #[CtlParamType(CtlParamType::TYPE_COOKIE, "u")]
        int $uid = 5,
        #[CtlParamType(CtlParamType::TYPE_HEADER, "hList")]
        array $hList = []
    ) {
    }

    /**
     * testStd
     * @param stdClass $body
     * @param DemoVo $get
     * @param DemoVo $path
     * @return void
     */
    public function testStd(
        #[CtlParamType] stdClass $body,
        #[CtlParamType(CtlParamType::TYPE_GET_PARAM)] DemoVo $get,
        #[CtlParamType(CtlParamType::TYPE_PATH_VARIABLE)] DemoVo $path
    ) {
    }

    /**
     * @param mixed $p1 @GetParam(p)
     * @param mixed $p2
     * @param string $body @RequestBody
     * @param string $autoPath
     * @param mixed $allGet @GetParam
     * @return void
     */
    public function index(
        #[CtlParamType(CtlParamType::TYPE_GET_PARAM, "p")] mixed $p1,
        mixed $p2,
        #[CtlParamType] string $body,
        string $autoPath,
        #[CtlParamType(CtlParamType::TYPE_GET_PARAM)] mixed $allGet
    ) {
    }

    /**
     * @param string $field
     * @param mixed $autoV1
     * @param int $autoV2
     * @param string $autoV3
     * @return void
     */
    public function testPost(#[CtlParamType(path: "field")] string $field, mixed $autoV1, int $autoV2, string $autoV3)
    {
    }

    /**
     * @param string $str
     * @param int $int
     * @param float $float
     * @param bool $bool
     * @param array $ary
     * @return void
     */
    public function testBodyField(
        #[CtlParamType(path: "s")] string $str,
        #[CtlParamType(path: "i")] int $int,
        #[CtlParamType(path: "f")] float $float,
        #[CtlParamType(path: "b")] bool $bool,
        #[CtlParamType(path: "a")] array $ary
    ) {
    }

    /**
     * @param callable $call
     * @return void
     */
    public function testBodyCall(#[CtlParamType(path: "c")] callable $call)
    {
    }

    /**
     * @param stdClass $var @RequestBody(c)
     * @return void
     */
    public function testNotStdClass(#[CtlParamType(path: "c")] stdClass $var)
    {
    }

    /**
     * @param DemoVo $vo
     * @return void
     */
    public function testDemoVo(#[CtlParamType(path: "")] DemoVo $vo)
    {
    }

    /**
     * @param ComplexVO $vo
     * @return void
     */
    public function testComplexVo(ComplexVO $vo)
    {
    }

    /**
     * @param string $key
     * @return OutputVo
     */
    #[Pure]
    public function protocol(string $key = "default"): OutputVo
    {
        return new OutputVo($key);
    }

    public function noTip($no)
    {
    }

    public function oneGet(#[CtlParamType(CtlParamType::TYPE_GET_PARAM, "p")] $p)
    {

    }

    public function unionType(string|int $string)
    {
    }

    public function customStd(stdClass $stdClass)
    {
    }
}

# end of file
